package com.fenyin.samples.study.parttern.struct.flyweight.example1;  

import java.util.HashMap;
import java.util.Map;

/**
 *@Title: 复合享元模式
 *<p>MessageClient：享元客户端</p>
 *@Author:fengzhichao  
 *@Since:2012-9-29  
 *@Version:1.1.0
 */
public class MessageClient {
	
	public static void main_1(String[] args){
		Message message1 = MessageFactory.getMessage(1, "我很想你!");
		Message message2 = MessageFactory.getMessage(1, "我很想你!");
		Message message3 = MessageFactory.getMessage(2, "周末有空吗？");
		Message message4 = MessageFactory.getMessage(3, "十一去看电影怎么样？");
		
		message1.display("冯志超");
		if(message1 == message2){
			message2.display("黄泽香");
		}
		message3.display("吴国勇");
		message4.display("曹文博");
	}
	
	public static void main(String[] args){
		Map<Integer,String> map = new HashMap<Integer,String>();
		map.put(1, "我很想你!");
		map.put(2, "周末有空吗？");
		map.put(3, "十一去看电影怎么样？");
		Message message = MessageFactory.getMessage(map);
		message.display("冯志超");
	}
}
